package com.zb.druid;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

public class test1 {
    //测试数据库连接
    public static void main(String[] args) throws Exception {
        ApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        DataSource dataSource = (DataSource)
                applicationContext.getBean("dataSource");
        Connection connection = dataSource.getConnection();
        System.out.println(connection);

    }
}
